package My.BasicDisciplineTools.Math;

public class ProbabilityTheory {
    //计算N的阶乘的方法
    private static int getNfactorial(int num){
        if(num==1){
            return 1;
        }
        return  num*getNfactorial(num-1);
    }
    //组合函数C
    public static int C(int superscript,int subscript){
        return getNfactorial(subscript)/(getNfactorial(subscript-superscript)*getNfactorial(superscript));
    }
    //排列函数P(A)
    public static int A(int superscript,int subscript){
        return getNfactorial(subscript)/getNfactorial(subscript-superscript);
    }
}